<?php
$server="localhost";
$username="root";
$password="";
$mysqli=new mysqli($server,$username,$password);
$result=mysqli_query($mysqli,"create database account_db");
echo"<p>创建数据库:";
var_dump($result);
$result=mysqli_query($mysqli,"use account_db");
echo"<p>选择数据库:";
var_dump($result);
$result=mysqli_query($mysqli,"set names utf8");
echo"<p>设置数据库编码:";
var_dump($result);
$result=mysqli_query($mysqli,
"create table account(id int auto_increment primary key,username varchar(50) not null,password varchar(50) not null,email varchar(50) not null)");
echo"<p>创建表:";
var_dump($result);
$result=mysqli_query($mysqli,"insert into account(username,password,email) values ('jack','123456','liuyi@example.com')");
echo"<p>插入数据:";
var_dump($result);
mysqli_close($mysqli);
?>